package com.maven.unit1;

/**
 * @author YongQiang
 * @date 2021/10/20 20:16
 */
public class Demo1_1_7 {
    public static void main(String[] args) {
        double t = 9.0;
        while (Math.abs(t-9.0/t)>.001){
            t=(9.0/t+t)/2.0;
        }
        System.out.printf("%.5f\n",t);

        int sum =0;
        for (int i=0;i<1000;i++){
            for (int j = 0; j < i; j++) {
                sum++;
            }
        }
        System.out.println(sum);

        sum =0;

        for (int i = 1; i < 1000; i*=2) {
            for (int j = 0; j < 1000; j++) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}
